package drds.server.route.parser.core;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 解析得到的结果
 * 
 * @author 曹正辉<330937205@qq.com>
 */
public class ParserResult {
	/**
	 * 原始sql
	 */
	private String sql;
	/**
	 * key table alias, value talbe real name;
	 */
	private Map<String, String> tableAliasMap = new LinkedHashMap<String, String>();
	/**
	 * key table alias, value column name;
	 */
	private Map<String, String> columnAliasMap = new LinkedHashMap<String, String>();
	/**
	 * 表信息统计
	 */
	private List<String> tableNameList = new ArrayList<String>();
	//
	private List<TableColumnValueSetMap> tableColumnValueSetMapList = new ArrayList<TableColumnValueSetMap>();

	public void setSql(String sql) {
		this.sql = sql;
	}

	public String getSql() {
		return sql;
	}

	public void setTableAliasMap(Map<String, String> tableAliasMap) {
		this.tableAliasMap = tableAliasMap;
	}

	public Map<String, String> getTableAliasMap() {
		return tableAliasMap;
	}

	public void setColumnAliasMap(Map<String, String> columnAliasMap) {
		this.columnAliasMap = columnAliasMap;
	}

	public Map<String, String> getColumnAliasMap() {
		return columnAliasMap;
	}

	public void addTableName(String tableName) {
		this.tableNameList.add(tableName);
	}

	public List<String> getTableNameList() {
		return tableNameList;
	}

	/**
	 * 设置多组条件的切分信息,一个list元素就是一组切分信息
	 */
	public void setTableColumnValueSetMapList(List<TableColumnValueSetMap> tableColumnValueSetMapList) {
		this.tableColumnValueSetMapList = tableColumnValueSetMapList;
	}

	public List<TableColumnValueSetMap> getTableColumnValueSetMapList() {
		return tableColumnValueSetMapList;
	}

	public TableColumnValueSetMap getFirstTableColumnValueSetMap() {
		return tableColumnValueSetMapList.get(0);
	}

	public void addTableColumnValueSetMap(TableColumnValueSetMap tableColumnValueSetMap) {
		this.tableColumnValueSetMapList.add(tableColumnValueSetMap);
	}

}
